import { Http } from '@/service/Http/index.js'
import * as types from './../mutation-types.js'

// 站点后台个性化配置
const custom = {
    state: {
        customInfo: {}
    },
    getters: {
        customInfo: (state) => state.customInfo
    },
    mutations: {
        [types.SAVE_CUSTOM_INFO] (state, customInfo) {
            state.customInfo = customInfo
        }
    },
    actions: {
        getCustomInfo ({ commit }) {
            Http.post('Home/GetHomeSetting', {})
            .then((res) => {
              if (res) {
                let customInfo = res.Data || []
                commit(types.SAVE_CUSTOM_INFO, customInfo)
                // console.log('customInfo:', customInfo)
              }
            })
        }
    }
}

export default custom